package cn.yunhe.dao;

import cn.yunhe.entity.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProductDao {

    @Select("select * from product")
    List<Product> findAll();

    @Insert("insert into product values (null,#{productNum},#{productName},#{cityName},#{departureTime},#{productPrice},#{productDesc},#{productStatus})")
    void addProduct(Product product);

    @Delete("delete from product where id = #{id}")
    void deleteById(Integer id);

    @Select("select * from product where id = #{id}")
    Product selectById(Integer id);

    @Update("update product set productNum = #{productNum},productName = #{productName},cityName = #{cityName}" +
            ",departureTime = #{departureTime},productPrice = #{productPrice},productDesc = #{productDesc}" +
            ",productStatus = #{productStatus} where id = #{id}")
    void updateById(Product product);


}
